﻿@model IEnumerable<Marketplace.Engine.Model.Property>

@{
    ViewBag.Title = "PropertyList";
}

<h2>Propert List</h2>
<p>
    @Html.ActionLink("Create New Rent", "Create") | @Html.ActionLink("Create New Sale", "Create")
</p>
<table>
    <tr>
        <th>
            PropertyType
        </th>
        <th>
            Status
        </th>
        <th>
            BedroomCount
        </th>
        <th>
            Name
        </th>
        <th>
            No
        </th>
        <th>
            Address
        </th>
        <th>
            PostCode
        </th>
        <th>
            Tel
        </th>
        <th>
            Price
        </th>
        <th>
            City
        </th>
       <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.PropertyType)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Status)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.BedroomCount)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.No)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Address)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.PostCode)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Tel)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Price)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.City)
        </td>
        <td>
            @if (item.PropertyType == 0)
            {
                @Html.ActionLink("Edit", "EditSaleProperty", new { id=item.Id }) 
                @Html.Label(" | ")
                @Html.ActionLink("Details", "DetailSaleProperty", new { id=item.Id }) 
                @Html.Label(" | ")
            }
            else
            {
                @Html.ActionLink("Edit", "EditRentProperty", new { id=item.Id })
                @Html.Label(" | ")
                @Html.ActionLink("Details", "DetailRentProperty", new { id=item.Id })
                @Html.Label(" | ")
            }
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })
        </td>
    </tr>
}

</table>
